{namespace core=TYPO3\CMS\Core\ViewHelpers}
<f:if condition="{configuration.insertAbove}">
	<f:render section="paginator" arguments="{pagination: pagination, position:'top', recordsLabel: configuration.recordsLabel}" />
</f:if>

<f:renderChildren arguments="{contentArguments}" />

<f:if condition="{configuration.insertBelow}">
	<f:render section="paginator" arguments="{pagination: pagination, position:'bottom', recordsLabel: configuration.recordsLabel}" />
</f:if>

<f:section name="paginator">
	<nav class="pagination-wrap">
		<ul class="pagination pagination-block">
			<f:if condition="{pagination.hasLessPages}">
				<f:then>
					<li>
						<a href="{f:widget.uri(arguments:{currentPage: 1})}" title="{f:translate(key:'widget.pagination.first')}">
							<core:icon identifier="actions-view-paging-first" />
						</a>
					</li>
					<li>
						<a href="{f:widget.uri(arguments:{currentPage: pagination.previousPage})}" title="{f:translate(key:'widget.pagination.previous')}">
							<core:icon identifier="actions-view-paging-previous" />
						</a>
					</li>
				</f:then>
				<f:else>
					<li class="disabled">
						<span>
							<core:icon identifier="actions-view-paging-first" />
						</span>
					</li>
					<li class="disabled">
						<span>
							<core:icon identifier="actions-view-paging-previous" />
						</span>
					</li>
				</f:else>
			</f:if>
			<li>
				<span>
					<f:if condition="{recordsLabel}">
						<f:then>
							{recordsLabel}
						</f:then>
						<f:else>
							<f:translate key="widget.pagination.records" />
						</f:else>
					</f:if>
					{pagination.startRecord} - {pagination.endRecord}
				</span>
			</li>
			<li>
				<span>
					<f:translate key="widget.pagination.page" />

					<form id="paginator-form-{position}" onsubmit="goToPage{position}(this); return false;" style="display:inline;">
					<script type="text/javascript">
						function goToPage{position}(formObject) {
							var url = '{f:widget.uri(arguments:{currentPage: 987654321})}';
							var page = formObject.elements['paginator-target-page'].value;
							if (page > {pagination.numberOfPages}) {
								page = {pagination.numberOfPages};
							} else if (page < 1) {
								page = 1;
							}
							url = url.replace('987654321', page);
							self.location.href= url;
						}
					</script>
					<f:form.textfield id="paginator-{position}" name="paginator-target-page" class="form-control input-sm paginator-input" size="5" value="{pagination.current}" />
					</form>

					/ {pagination.numberOfPages}
				</span>
			</li>
			<f:if condition="{pagination.hasMorePages}">
				<f:then>
					<li>
						<a href="{f:widget.uri(arguments:{currentPage: pagination.nextPage})}" title="{f:translate(key:'widget.pagination.next')}">
							<core:icon identifier="actions-view-paging-next" />
						</a>
					</li>
					<li>
						<a href="{f:widget.uri(arguments:{currentPage: pagination.numberOfPages})}" title="{f:translate(key:'widget.pagination.last')}">
							<core:icon identifier="actions-view-paging-last" />
						</a>
					</li>
				</f:then>
				<f:else>
					<li class="disabled">
						<span>
							<core:icon identifier="actions-view-paging-next" />
						</span>
					</li>
					<li class="disabled">
						<span>
							<core:icon identifier="actions-view-paging-last" />
						</span>
					</li>
				</f:else>
			</f:if>
			<li>
				<a href="{f:widget.uri(arguments:{currentPage: pagination.current})}" title="{f:translate(key:'widget.pagination.refresh')}">
					<core:icon identifier="actions-refresh" />
				</a>
			</li>
		</ul>
	</nav>
</f:section>